import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
import ProManagerController from '../views/ProManagerController'
import KindsController from '../views/KindsController'
import DetailController from '../views/DetailController'
import Y from "./Y";
import Login from '../views/Login'
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'Login',
    component:Login,
    meta: {
      title: '小木商城后台管理系统'
    }
  },
  {
    path: '/home',
    name: 'Home',
    component: Home,
    meta: {
      title: '首页'
    },
    children:[
      {
        path: '/test',
        name: 'Qtest',
        component: () => import( '../views/Qtest.vue'),
        meta: {
          title: '测试'
        }
      },
      {
        path:'/DetailController',
        name:'DetailController',
        component:DetailController
      },
      {
        path:'/ProManagerController',
        name:'ProManagerController',
        component:ProManagerController
      },
      {
        path:'/KindsController',
        name:'KindsController',
        component:KindsController
      },
      ...Y,
      //默认加载页面
      {  path:'/', component: () => import('../views/Shome.vue') ,meta:{title:'首页'}},
    ]
  },
  {
    path: '/about',
    name: 'About',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
